﻿package ascript.components.willard
{
	//#########################
	// Header Includes
	//#########################
	import ascript.components.collision.CollisionBase;
	import ascript.GameObject;
	import Box2D.Dynamics.b2Body;
	import Box2D.Dynamics.b2Fixture;
	
	//#########################
	// GeneralModifiers Class
	//#########################
	public class WillardCollisionPlayer extends CollisionBase
	{
		//=========================
		// Constructors
		//=========================	
		public function WillardCollisionPlayer():void
		{
		}
		
		//=========================
		// Members
		//=========================
		override public function handleCollision( tObject:GameObject, tObjectHit:GameObject, tFixture:b2Fixture, tFixtureHit:b2Fixture, tIsTouching:Boolean ):Boolean
		{
			// Inheritance
			if ( super.handleCollision( tObject, tObjectHit, tFixture, tFixtureHit, tIsTouching ) )
			{
				switch( tObjectHit.getAttribute( "CollisionID" ) )
				{
					case "Pill":
						if ( tIsTouching )
						{
							tObject.setAttribute( "PillAmount", ( tObject.getAttribute( "PillAmount" ) + 1 ) );
						}
						break;
					case "Bottle":
						if ( tIsTouching )
						{
							tObject.setAttribute( "BottleIsActive", true );
						}
						break;
					case "Monster":
						switch( tFixtureHit.GetUserData() )
						{
							case "Body":
								tObject.setAttribute( "AnimationDeathIsEnabled", true );
								break;
							case "Patrol":
								break;
							default:
								break;
						}
						break;
					default:
						break;
				}
			}
			
			return true;
		}
		
		override public function solveCollision( tObject:GameObject, tObjectHit:GameObject, tFixture:b2Fixture, tFixtureHit:b2Fixture, tIsPresolve:Boolean ):Boolean
		{
			// DONT CARE
			return false;
		}
	}
}